Generating a Decorative Image Bar Code Using Filter Patterns

ABSTRACT

A composite image is generated from a decorative image, a bar code, and one or more filter patterns. The composite image visually approximates the decorative image, yet the composite is machine-readable by a scanner capable of reading the original bar code, and the composite encodes the same data as the original bar code. Filter patterns provide a flexible way to selectively alter the decorative image. Alterations can be applied only in locations where necessary, and only to the degree necessary, in order for the composite image to be recognized as a bar code. Alterations can also be applied in arbitrary color spaces, including human perceptual color spaces where brightness can be altered with less impact on apparent color.

BACKGROUND OF THE INVENTION

Bar codes, which comprise both one-dimensional and two-dimensional codes, have become popular for encoding data. However, because these, codes were designed to be machine-readable by a bar code scanner, they are generally visually unattractive. The most common representations appear as jumbled collections of dark and light regions, or “cells”.

A bar code that is machine-readable but visually appealing could be advantageous. However, realizing this by defining a new bar code format might require significant time and resources to gain significant adoption. One could avoid the problems of adoption if one could instead produce a hybrid: a visually appealing image that can also be recognized by an existing bar code scanning device as a valid code. However, there are challenges with producing such a hybrid image.

For example, any approach that blindly destroys part of the code and replaces it with visually appealing data, intending to rely on redundancy or error correction built into the code, can only alter a fraction of the code region before the code becomes unscannable. Furthermore, any such approach makes the code less robust against routine scanning errors.

As another example of the challenge, any approach that simply alters the shape or size of bar code cells is quite limited in the kinds of effects it can achieve. It would not be possible to visually represent arbitrary images using such an approach.

As a third example of the difficulty, any approach that applies a uniform image compositing operation between an arbitrary image and a bar code image is likely find the results unsatisfactory. Within each cell region, the resulting image can either be machine readable but at the expense of human recognition (i.e., the entire cell is quite dark or light), or it can be human recognizable but at the expense of machine readability (i.e., a bar code scanner cannot easily decide whether to interpret the cell as a light or dark region), but not both.

BRIEF SUMMARY OF THE INVENTION

In one embodiment of the present invention, a composite image is generated from a decorative image having a plurality of pixels, a bar code having a plurality of cells, and one or more filter patterns; wherein the composite image visually approximates the decorative image, yet the composite is machine-readable by a scanner capable of reading the original bar code, and the composite encodes the same data as the original bar code.

The term “decorative” should not be taken as limiting the type of image supported. The decorative image can be any arbitrary pixel image.

A filter pattern encodes a set of alterations or constraints that should be made to the decorative image. Filter patterns provide a flexible way to selectively update the decorative image. Alterations or Constraints can be applied only in locations where necessary, and only to the degree necessary, in order for the composite image to be recognized as a bar code. Alterations can also be applied in arbitrary color spaces, including human perceptual color spaces where brightness can be altered with less impact on apparent color.

In the aforementioned embodiment: the bar code is positioned to coincide with some region of the decorative image; one or more filter patterns are assigned to each bar code cell; and each pixel within the decorative image is processed according to the filter patterns, thus forming the composite image.

More specifically, the processing of pixels within the decorative image comprises, for each pixel position: retrieving the pixel color in the decorative image at that pixel position; retrieving the values of all filter patterns at that pixel position; and updating the pixel color by applying all constraints or alterations specified by the set of filter pattern values.

In another embodiment of the present invention, filter patterns may define operations in an arbitrary color space, and when updating a pixel color using one of these filter patterns: the pixel color is transformed into the arbitrary color space; the filter pattern operation is applied in the arbitrary color space; and the updated color is transformed back into the color space of the original pixel.

Operations in arbitrary color spaces are useful because numerous bar code scanners consider only brightness, while the human visual system considers color as well. By altering brightness independently from color (to the extent this is possible), one can better produce machine-readable cells that also preserve features important to the human visual system.

In another embodiment of the present invention, a filter pattern may be defined as to: only manipulate a subset of a cell; or smoothly vary the degree of manipulation across a cell.

In this way, portions of the cell that are more critical to recognition by a scanner can be constrained more severely (to ensure proper recognition by the bar code scanner), while portions of the cell that are less critical to recognition can be constrained or altered less severely. (Bar code scanners typically do not examine every visible aspect of a given code.) This maximally preserves the decorative image when forming the composite image.

In another embodiment of the present invention, a filter pattern may be used to adorn the composite image with some additional visual element.

BRIEF DESCRIPTION OF THE DRAWINGS

FIGS. 1 a, 1 b, and 1 c illustrate an example of a composite image, bar code, and decorative image, according to one embodiment of the invention.

FIG. 2 illustrates an example of a filter pattern, according to one embodiment of the invention.

FIG. 3 illustrates a system for generating a composite image from a decorative image, a bar code, and one or more filter patterns, according to one embodiment of the invention.

FIG. 4 illustrates high-level steps for producing the composite image, according to one embodiment of the invention.

FIG. 5 illustrates steps for processing each pixel within the decorative image to form the composite image, according to one embodiment of the invention.

FIG. 6 illustrates the application of a filter that operates in a color space different from that of the decorative image, according to one embodiment of the invention.

FIG. 7 illustrates, numerically, examples of the application of specific filter pattern values to specific RGB pixel values, according to one embodiment of the invention.

FIGS. 8 a, 8 b, 8 c, and 8 d illustrate, visually, examples of the application of specific filter patterns to specific decorative image regions, according to one embodiment of the invention.

DETAILED DESCRIPTION OF THE INVENTION

FIG. 1 a illustrates an example of a decorative image bar code 100 created using the present invention. It is a composite image, generated from a bar code 110 as shown in FIG. 1 b, a decorative image 120 as shown in FIG. 1 c, and several filter patterns, an example of which is illustrated in FIG. 2.

The bar code 110 comprises a plurality of cells 112. In the example shown in FIG. 1 b, the bar code is a two-dimensional code, and the bar code comprises a grid of square cells, each cell having a value that is one of two brightness levels, which may be denoted as “dark” and “light”. For simplicity, and without loss of generality, the remainder of this specification will focus on bar codes having such a form, but the methods and systems described in the present invention are equally applicable to other bar codes, including: one- and two-dimensional codes; codes having cells of other shapes and sizes; and codes where each cell may take on more than two possible values, and whose values may be denoted by something other than brightness. One skilled in the art shall be able to apply these methods and systems to other bar codes where each cell covers a particular region of the code, and each cell has a value chosen from a small set of possible values.

FIG. 2 illustrates an example of a filter pattern 200. A filter pattern encodes a set of values that are used to update the colors of pixels whose positions coincide with the filter pattern. A filter pattern may span exactly one bar code cell, or numerous cells, or subsets of one or more cells. For simplicity, and without loss of generality, the remainder of this specification will focus on filter patterns spanning exactly one cell, but the methods and systems described in the present invention are equally applicable to all other filter pattern extents. One skilled in the art need only know, for a given pixel position, which filter patterns coincide with that position, and the specific location within each the filter pattern to which the pixel position corresponds.

It is simplest to consider a filter pattern that comprise a plurality of pixels, wherein each pixel encodes values representing a constraint or alteration. However, that is not the only possibly embodiment. For example, a filter pattern could be defined using a mathematical formula, or another suitable representation, as long as pixel positions can be mapped to constraint or alteration values.

A filter pattern need not have the same resolution (width and height) as the region of pixels in the decorative image with which the filter pattern coincides. Standard image processing techniques can be used to upsample or downsample the filter pattern as needed.

In the example filter pattern 200, if each position is encoding a minimum allowed brightness 202 and a maximum allowed brightness 204, then applying a value from such a filter pattern to a pixel color comprises updating the pixel's brightness to ensure it lies between the minimum and maximum allowed brightness.

Filter patterns need not encode a specific type of constraint or alteration to be carried out. This is because the computer program that makes use of the filter patterns also chooses which constraint or alteration to apply. So the filter pattern need only encode, if being used for a constraint, a pair of values to be treated as a minimum and maximum. In one embodiment, the computer program applying the filter patterns may only apply brightness constraints to the pixels of the decorative image.

The values in a filter pattern can vary across a bar code cell, as illustrated in FIG. 2. In the example filter pattern we have described, pixels at the center of the pattern (where the allowed brightness range is 0% to 20%) are guaranteed to be darkest after filtering, pixels at the corners (where the allowed brightness range is 0% to 100%, i.e. the entire range of possible values) will remain unmodified after filtering, and pixels in-between are only guaranteed to be slightly darkened. Less restrictive filter pattern values allow the composite image to much better approximate the decorative image.

Having defined several components, it is appropriate to now discuss the methods and systems of the present invention.

FIG. 3 illustrates an example system 300 for generating a composite image from a decorative image, a bar code, and one or more filter patterns. Generation of the composite image occurs on a first computing system 310. System 310 comprises a computer program for generating the composite image, along with any combination of software, hardware, or firmware necessary for running that computer program.

The computer program, decorative image, bar code, and filter patterns used in system 300 are retrieved from some combination of: local memory inside system 310, locally attached storage 312, network-attached storage 322 via a network 320, or a second computing system 330 also via a network 320, wherein the second computing system may have itself retrieved any computer program, decorative image, bar code, and filter patterns patterns from local memory inside system 330, locally attached storage 332, or network-attached storage 322.

As the composite image is generated by system 310, it is output to any combination of: local memory inside system 310, locally attached storage 312, network-attached storage 322 via a network 320, or a second computing system 330 also via a network 320. The composite image may then additionally be converted to one or more graphics file formats, such as PNG, JPEG, or GIF, and these too may be output to any combination of the locations to which the composite image could be output.

FIG. 4 illustrates the high-level steps involved in generating the composite image. At step 402 the decorative image and bar code are positioned relative to each other so that the bar code coincides with some region of the decorative image. The positioning may be done automatically by the computer program in system 310, or it may involve interactive or non-interactive instruction from a user. For simplicity, and without loss of generality, consider the bar code as coinciding with some subset of the decorative image. If the bar code extends beyond the decorative image, consider the decorative image as having a border large enough to contain the bar code.

At step 404, one or more filter patterns are assigned to each cell of the bar code. At a minimum, for each dark or light cell in the bar code, a corresponding darkening or lightening filter pattern is assigned to that cell.

A given cell may have more than one filter pattern assigned to it. As an example, one set of filter patterns may be assigned across the entire bar code to emulate the necessary dark or light cells in the composite image, while an additional set of filter patterns may be assigned across a portion of the bar code to adorn the composite image with some additional visual element, such as a watermark, banner, or other design. Safeguards in the program can guard against conflicting filter patterns being assigned to a cell (e.g., one filter pattern that darkens the cell and one that lightens it).

Different cells may use different darkening or lightening filter patterns. As an example, the default filter pattern may be one that enforces darkness or lightness only in the center of each cell. But in some cells, it may be necessary (e.g., due to specifics of the bar code scanner intended to be used), to use a more conservative filter pattern that enforces darkness or lightness on the entire cell. Alternately, it may be desirable to use a variety of filter patterns, having different properties or designs, to achieve particular aesthetic effects in the composite image.

At step 406, each pixel within the decorative image is processed (as described below). The final composite image comprises this collection of processed pixels.

FIG. 5 illustrates the steps involved in processing each pixel within the decorative image.

At step 502, the position of the pixel currently being processed is used to retrieve the pixel color at that position in the decorative image.

At step 504, the position of the pixel currently being processed is used to retrieve the values of all filter patterns coinciding with at that position.

At step 506, if all filter pattern values have been applied to the current pixel color, processing is complete, and the pixel color for the composite image has been determined.

However, if at step 506 there is a filter pattern value that has not been applied to the current pixel color, the pixel color is updated at step 508 using the unapplied filter pattern value, and execution returns to step 506.

The filter pattern operation in step 508 may operate in a different color space than the color space of the current pixel. For example, the current pixel may be defined with red, green, and blue (R, G, B) components, while the filter pattern operation may operate on brightness (Y) in the (Y, I, Q) color space. FIG. 6 illustrates the steps that take place when the color spaces differ.

At step 602 in FIG. 6, the current pixel color is transformed into the color space used by the current filter pattern. This transformation comprises operations that are well known to those versed in the art of image processing. At step 604, the filter pattern operation is applied to the transformed pixel color. And at step 606, the pixel color with the filter pattern applied is transformed back into the earlier color space, again using operations that are well known to those versed in the art of image processing.

FIG. 7 illustrates, numerically, several typical examples of the end-to-end transformation of a pixel color from the decorative image to the composite image. In these examples: the R, G, B, and Y color components each exist in the range [0.0, 1.0]; the I color component exists approximately in the range [−0.6, 0.6]; and the Q color component exists approximately in the range [−0.52, 0.52].

Row 702 demonstrates a red pixel with (R, G, B) value (1.0, 0.0, 0.0) that coincides with a dark cell of the bar code. Because the pixel's Y value (0.3) is above the maximum Y value permitted by the filter pattern at that position (0%-20%), application of the filter pattern reduces the Y value to 0.2. When converted back to the (R, G, B) color space, the processed pixel has the color (0.9, 0.0, 0.0) which is a slightly darker shade of red.

Row 704 demonstrates a pixel with the same red color that coincides with a light cell of the bar code. The pixel's Y value gets increased from 0.3 to 0.8 when the filter pattern is applied, and the resulting color in the (R, G, B) color space is (1.0, 0.5, 0.5), which is a lighter value of red.

Row 706 demonstrates a dark gray pixel that coincides with a dark cell of the bar code, and row 708 demonstrates a light gray pixel that coincides with a light cell of the bar code. In both cases, the Y value of the pixel falls within the range permitted by the filter pattern at that position, so the Y value remains unchanged, and the color of the processed pixel in the (R, G, B) color space is identical to that of the original pixel.

FIGS. 8 a, 8 b, 8 c, and 8 d illustrate a detailed view of a portion of a decorative image, coinciding with two bar code cells, being transformed into a corresponding portion of a composite image, through the application of two filter patterns applied to each bar code cell. More specifically, the decorative image region 800 in FIG. 8 a comprises a left half containing a solid gray color and a right half containing a gradient from black to white. The filter pattern 810 in FIG. 8 b and the filter pattern 820 in FIG. 8 c represent filters that constrain the brightness of each corresponding pixel to lie between 0% and the brightnesses shown in the corresponding position in 810 and 820, where the white areas at the edge of those images represent 100% brightness, the darkest areas represent 20% brightness, and other areas represent brightnesses between those extremes. Note that grayscale pixels are being used in this example for simplicity, but the exact same logic would apply for colored pixels.

Filter pattern 810 in FIG. 8 b is an example of the type of filter pattern that might be used to represent a dark cell in the composite image. Filter pattern 820 in FIG. 8 c is an example of a filter pattern that might be used to adorn the composite image with some additional visual element, such as part of a watermark, banner, or other design.

The composite image region 830 in FIG. 8 d illustrates the result after applying both filter patterns, 810 and 820, to each half of the decorative region. As shown in the figure, both halves contain the visual element introduced by filter pattern 820. Furthermore, even after applying the constraints of filter pattern 810, both halves preserve the original decorative image almost perfectly near the border of each cell. Likewise, the areas further inward still preserve significant detail. Additionally, the right half of the region containing the gradient preserves the original decorative image throughout much of the entire top half of the cell, moreso than the left half that contains the solid color, because the top half of the right cell is already closer to meeting the constraint being applied.

As demonstrated by FIGS. 8 a, 8 b, 8 c, and 8 d, the use of filter patterns enables the composite image to very closely approximate the decorative image. Filter patterns allow for: only manipulating a subset of a cell; smoothly varying the degree of manipulation across a cell; and, by using filter patterns that represent brightness-based constraints in a color space that accounts for human visual perception, leaving the decorative image unmodified at pixels where the decorative image already satisfies the brightness constraints being applied by the filter pattern. 

What is claimed is:
 1. A computer-implemented method for generating a composite image, comprising a decorative image having a plurality of pixels, a bar code having a plurality of cells, and one or more filter patterns; wherein the composite image visually approximates the decorative image, yet the composite is machine-readable by a scanner capable of reading the original bar code, and the composite encodes the same data as the original bar code; the method comprising: positioning the bar code to coincide with some region of the decorative image; assigning one or more filter patterns to each bar code cell; and processing each pixel within the decorative image, thus forming the composite image; the processing of pixels within the decorative image comprising, for each pixel position: retrieving the pixel color in the decorative image at that pixel position; retrieving the values of all filter patterns at that pixel position; and updating the pixel color by applying the set of filter pattern values.
 2. The method according to claim 1, wherein some filter patterns define operations in an color space different from the decorative image pixels, and wherein the method for updating the pixel color by applying the set of filter pattern values comprises: transforming the pixel color into the arbitrary color space; applying the filter pattern operations in the arbitrary color space; and transforming the updated color back into the color space of the original pixel.
 3. The method according to claim 1, wherein some filter patterns: only manipulate a subset of a cell; or smoothly vary the degree of manipulation across a cell thereby maximally preserving the decorative image when forming the composite image.
 4. The method according to claim 1, wherein some filter patterns act to adorn the composite image with some additional visual element.
 5. A system for generating a composite image, comprising a decorative image having a plurality of pixels, a bar code having a plurality of cells, and one or more filter patterns; wherein the composite image visually approximates the decorative image, yet the composite is machine-readable by a scanner capable of reading the original bar code, and the composite encodes the same data as the original bar code; the system comprising a computer program for generating the composite image, along with any combination of software, hardware, or firmware necessary for running that computer program, wherein the computer program: positions the bar code to coincide with some region of the decorative image; assigns one or more filter patterns to each bar code cell; and processes each pixel within the decorative image, thus forming the composite image; the processing of pixels within the decorative image comprising, for each pixel position: retrieving the pixel color in the decorative image at that pixel position; retrieving the values of all filter patterns at that pixel position; and updating the pixel color by applying the set of filter pattern values.
 6. The system according to claim 5, wherein the filter patterns define operations in an color space different from the decorative image pixels, and wherein the system that updates the pixel color by applying the set of filter pattern values: transforms the pixel color into the arbitrary color space; applies the filter pattern operations in the arbitrary color space; and transforms the updated color back into the color space of the original pixel.
 7. The system according to claim 5, wherein some filter patterns: only manipulate a subset of a cell; or smoothly vary the degree of manipulation across a cell thereby maximally preserving the decorative image when forming the composite image.
 8. The system according to claim 5, wherein some filter patterns act to adorn the composite image with some additional visual element. 